<template>
	<text>{{ formItem.t_name }}</text>
	<uni-datetime-picker type="time" v-model="value"  @change="handleDateChange" />
</template>
<script lang="ts" setup>
	import { ref } from 'vue'
	// import { useWebSocket } from "../hook/index";
	// const ws = useWebSocket();
	const props = defineProps({
		formItem: {
			type: Object,
			required: true
		},
		ws:
		{
			type:WebSocket,
			required:true
		}
	})
	
	let value = ref(props.formItem.set_value || '')

	const handleDateChange = (val : Date) => {
		value.value=val;
		props.ws.send({data:
			JSON.stringify({
				page: 5,
				type: -1,
				value: value.value,
				config_id: props.formItem.id,
				d_no: 1
			})}
		);
	}
</script>